// pages/mine/anchorDeliver/index.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    resume: [],
    page_resume: 1,

  },
  //查看体现详情
  go_detail: function (e) {
    // console.log(e.currentTarget.dataset.deatil_id)0
    let deatil_id = e.currentTarget.dataset.deatil_id;
    wx.navigateTo({
      url: '../../recruit/detail/detail?deatil_id=' + deatil_id,
    })
  },
  //简历加载
  load_resume: function (e) {
    let that = this;
    let page_resume = this.data.page_resume;
    page_resume = page_resume + 1;
    that.setData({
      page_resume: page_resume
    })
    this.list_resume();
    console.log("update")
  },
  //简历加载
  resumeList(_page) {
    let that = this;
    wx.request({
      url: app.globalData.url + 'api/recruit/link/up/list',
      method: 'POST',
      data: {
        token: app.globalData.token,
        type: 1,
        page: _page,
      },
      success: function (e) {
        // console.log(e)

        if (e.data.data.list.current_page > e.data.data.list.last_page) {
          console.log("到底了");
          wx.showToast({
            title: '到底啦~',
            icon: 'none',
          })
        } else {
          if (that.data.page_resume == 1) {
            that.setData({
              resume: e.data.data.list.data,
            })
          } else {
            // console.log("不不不不不");
            let resume = that.data.resume;
            let _resume = e.data.data.list.data;
            resume.push(..._resume)
            console.log(resume);
            that.setData({
              resume: resume,
            })
          }
        }
        wx.hideLoading();
      }
    })
  },
  // 简历加载
  list_resume: function (e) {
    let that = this;
    let page_resume = this.data.page_resume
    that.resumeList(page_resume);
    // wx.showLoading({
    //   icon: 'none',
    // })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.list_resume();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    this.setData({
      collects: [],
    })
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})